package bairui.international.console.web.controller.advance.category;

/**
 * @see bairui.international.console.web.controller.advance.category.ProductPage_BaseFilter
 *
 */
class ProductPage_Filter

{
	
	/**
	 * 过滤扩展接口
	 */
	static interface FilterExtends {
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_Product QRoot,
		javax.servlet.http.HttpServletRequest request
	) {
		com.querydsl.core.BooleanBuilder query = query(
				QRoot
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("number"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("name"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("state"), 
						bairui.international.model.status.State_Product.class, 
						"yyyy-MM-dd"
					)
			);
			/* comment 附加过滤属性 */
	;
		return query;
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_Product QRoot
	,	String number
	,	String name
	,	bairui.international.model.status.State_Product state
	) {
		com.querydsl.core.BooleanBuilder builder = new com.querydsl.core.BooleanBuilder();
	
		if(null != number){
			builder.and(QRoot.number.like("%"+number+"%"));
		}
		if(null != name){
			builder.and(QRoot.name.like("%"+name+"%"));
		}
		if(null != state){
			builder.and(QRoot.state.eq(state));
		}
		return builder;
	}
	
}
